package com.example.arithmeticleetcode.leetcode.September;

/**
 * @program: arithmetic-leetcode
 * @description:
 * @author: FangZhen
 * @create: 2020-09-01 17:55
 **/
public class Demo01 {

    public static void main(String[] args) {

    }


    public boolean containsPattern(int[] arr, int m, int k) {
        int len = arr.length;

        for(int i = 0; i <= len - m * k; i++){
            int c = 1;
            int l = 0;
            int j = i;
            int f = i + m;
            while(c < k){
                if(arr[f] != arr[j]){
                    break;
                }
                f++;
                j++;
                l++;
                if(l == m){
                    l = 0;
                    c++;
                }
            }
            if(c == k){
                return true;
            }
        }
        return false;
    }
}
